/**
 * Created by Administrator on 2017/3/15.
 */
var HyperLink = require('../../../../src/libs/hyperlink');

var Step3 = React.createClass({
    getDefaultProps:function() {
        return{
            pagedm:this.props.pagedm
        }
    },
    getInitialState:function(){
        return{
            home:PageDM.URL.home,
            data:PageDM.step3.value
        }
    },
    componentDidMount:function(){
        var _this = this;
        var _nodeSec = this.refs.second;
        var second = Number(_nodeSec.innerText);
        var time = setInterval(function(){
            if(second > 0){
                second--;
                _nodeSec.innerText = second;
            }else{
                clearInterval(time);
                window.location.href = _this.state.data.turnLink;
            }
        },1000);
    },
    render:function(){
        var pagedm = this.props.pagedm;
        return(
            <div className="text-wrap find-pwd-text">
                <h1><i className="icon-success iconfont"></i>{this.state.data.successTxt}</h1>
                <p>系统将在 <span className="fc-main" ref="second">{this.state.data.count}</span> 秒后自动跳转至{this.state.data.turnTxt}，您可以选择直接 <HyperLink href={this.state.data.toLink} text={this.state.data.toText} className="fc-link"/></p>
            </div>
        )
    }
});
module.exports = Step3;